package com.webbei.shoppingCar.action;

import java.util.HashSet;
import java.util.Set;

import com.webbei.pojo.Customs;
import com.webbei.shoppingCar.service.shoppingCarService;

public class chenkPayCondition {
	private shoppingCarService scs;
	private String customId;
	private int f;
	public String execute(){
		String[] ids = customId.split(",");
		Set<String> set1=new HashSet<String>();
		Set<String> set2=new HashSet<String>();
		if(ids.length==1){
			f=1;
		}else{
			Customs c=new Customs();
			for(int i=0;i<ids.length;i++){
				c=scs.getCustomsById(Long.parseLong(ids[i]));
				set1.add(c.getReceiveName());
				set2.add(c.getReceiveAddress());
			}
			if(set1.size()<2&&set2.size()<2){
				f=1;
			}else{
				f=0;
			}
		}
		return "success";
	}
	public String getCustomId() {
		return customId;
	}
	public void setCustomId(String customId) {
		this.customId = customId;
	}
	public int getF() {
		return f;
	}
	public void setF(int f) {
		this.f = f;
	}
	public void setScs(shoppingCarService scs) {
		this.scs = scs;
	}
}
